package car.Postal.Grimentz;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import car.Postal.Grimentz.Geopoint;


public class OverlayItem{
	
	Bitmap icon;
    
	static final int GAUCHE = 1;
	static final int DROITE = 2;
	static final int HAUT = 3;
	
	Geopoint position;
	String nom;
	int textPosition ;
	//46.176037, 7.574043 
	public OverlayItem( )
	{
		position = new Geopoint(0, 0);
		textPosition = HAUT;
	}
	
	
	public OverlayItem( long latitude_, long longitude_,String nom_, int textPosition_,Bitmap icon_)
	{
		position = new Geopoint(latitude_, longitude_);
		nom = nom_;
		textPosition =textPosition_;
		icon = icon_ ;
		
	}
	
	public Bitmap getIcon()
	{
		return(icon);
	}
	
	public Geopoint getPosition()
	{
		return position;
	}
	public String getName() {
		return nom;
	}
	
	public void OffsetText(Point point,int dpi)
	{
		if(textPosition == DROITE)
		{
			point.x = point.x+icon.getWidth()/2;
			point.y = (int) (point.y+icon.getHeight()/4);
		}
		else if(textPosition == HAUT)
		{
			point.y = (int) (point.y-icon.getHeight()/2);
			point.x = point.x- (nom.length()*dpi/50);
		}else if(textPosition == GAUCHE)
		{
		//	point.y = (int) (point.y+stationIcon.getHeight());
			point.x = point.x+icon.getWidth()/2;
			point.x = point.x- (nom.length()*dpi/24);
		}
			
	}


	public void setNom(String nom_) {
		nom = nom_;
		
	}


	public void setLatitude(long lati) {
		
		position.latitude= lati;
	}


	public void setLongitude(long longi) {
		position.longitude= longi;
		
	}


	public void setIcon(Bitmap icon_) {
		icon = icon_ ;
	}

}